//package com.allwees.data.dataport.module.useraction.mq.consume;
//
//import com.allwees.bs.core.model.useraction.bo.ActionLogDTO;
//
//import com.allwees.bs.core.model.useraction.bo.ProductPublishDTO;
//import com.allwees.bs.core.model.useraction.bo.ProductShowLogDTO;
//import com.allwees.bs.core.model.useraction.bo.PvLogDTO;
//import com.allwees.data.dataport.module.product.doc.ProductLog;
//import com.allwees.data.dataport.module.useraction.entity.ActionLog;
//import com.allwees.data.dataport.module.useraction.entity.ProductShowLog;
//import com.allwees.data.dataport.module.useraction.entity.PvLog;
//import com.allwees.data.dataport.module.useraction.service.ActionLogService;
//import com.allwees.data.dataport.module.useraction.service.ProductLogService;
//import com.allwees.data.dataport.module.useraction.service.ProductShowLogService;
//import com.allwees.data.dataport.module.useraction.service.PvLogService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Lazy;
//import org.springframework.data.elasticsearch.core.query.UpdateQuery;
//import org.springframework.stereotype.Component;
//
//import javax.persistence.criteria.CriteriaBuilder;
//
///**
// *
// *
// * @author yangylsky
// * @since 2020-03-25
// *
// */
//@Slf4j
//@Lazy(false)
//@Component
//@RabbitListener(queues = "q.UserAction.SaveLog")
//public class LogListener {
//    @Autowired
//    private ActionLogService actionLogService;
//
//    @Autowired
//    private PvLogService pvLogService;
//
//    @Autowired
//    private ProductShowLogService showLogService;
//
//    @Autowired
//    private ProductLogService  productLogService;
//
//    @RabbitHandler
//    public void processActionLog(ActionLogDTO dto) {
//        //log.info("process action log, ActionLogDTO :{} ",dto);
////    	throw new RuntimeException("test");
//        actionLogService.saveToEs(ActionLog.of(dto));
//    }
//
//    @RabbitHandler
//    public void processPvLog(PvLogDTO dto) {
//        //log.info("process pv log, action type :{} ",dto.getUaType().name());
//        pvLogService.saveToEs(PvLog.of(dto));
//    }
//
//    @RabbitHandler
//    public void processShowLog(ProductShowLogDTO dto) {
//        //log.info("process show log, action type :{} ",dto.getUaType().name());
//        showLogService.saveToEs(ProductShowLog.of(dto));
//    }
//
//    @RabbitHandler
//    public void processProductPublishLog(ProductPublishDTO dto) {
//       // log.info("process product log, action type :{} ",dto.getProductStatus());
//        if(productLogService.updateProductStatusByUuid("bs_product","productUuid",dto.getProductUuid(),"productStatus",dto.getProductStatus()) == 0){
//            productLogService.saveToEs(ProductLog.of(dto));
//        }
//
//    }
//}
